﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Xyz.Service;
using Xyz.Service.DataTransferObjects;

namespace Xyz.Web.Admin.Administrator
{
    public partial class CreateAdmin : System.Web.UI.Page
    {
        AdministratorService administratorService = new AdministratorService();        

        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            AdministratorDTO adminDTO = new AdministratorDTO();
            adminDTO.AdminLoginId = txtUsername.Text;
            adminDTO.Password = txtPassword.Text;
            adminDTO.FirstName = txtFirstName.Text;
            adminDTO.LastName = txtLastName.Text;
            adminDTO.Gender = (rdbMale.Checked) ? "M" : "F";
            adminDTO.DateOfBirth = DateTime.Parse(txtDob.Text);

            administratorService.CreateAdministrator(adminDTO);
            Response.Redirect("../Flight/SearchFlightSchedule.aspx");
        }

    }
}